import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "@v/layout";
import Cookie from "@u/cookie";
import { Toast } from "vant";
Vue.use(Toast);
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Layout,
    redirect: "/home",
    children: [
      {
        path: "/mine",
        name: "Mine",
        component: () => import("@v/mine")
      },
      {
        path: "/home",
        name: "Home",
        component: () => import("@v/home")
      },
      {
        path: "/medicalRecord",
        name: "MedicalRecord",
        component: () => import("@v/medicalRecord")
      }
    ]
  },
  {
    path: "/cj_problem",
    name: "Cj_problem",
    component: () => import("@v/page/cj_problem")
  },
  {
    path: "/hf_problem",
    name: "Hf_problem",
    component: () => import("@v/page/hf_problem")
  },
  {
    path: "/choose_hos",
    name: "Choose_hos",
    component: () => import("@v/page/choose_hos")
  },
  {
    path: "/fk_suggestion",
    name: "Fk_suggestion",
    component: () => import("@v/page/fk_suggestion")
  },
  {
    path: "/page_search",
    name: "Page_search",
    component: () => import("@v/page/page_search")
  },
  {
    path: "/qiandao",
    name: "qiandao",
    component: () => import("@v/page/qiandao")
  },
  {
    path: "/yindao",
    name: "yindao",
    component: () => import("@v/page/yindao")
  },
  {
    path: "/qianinfo",
    name: "qianinfo",
    component: () => import("@v/page/qianinfo")
  },
  {
    path: "/sc_doctor",
    name: "Sc_doctor",
    component: () => import("@v/page/sc_doctor")
  },
  {
    path: "/xq_appoint",
    name: "Xq_appoint",
    component: () => import("@v/page/xq_appoint")
  },
  {
    path: "/se_doctor",
    name: "se_doctor",
    component: () => import("@v/page/se_doctor")
  },
  {
    path: "/add_doctor",
    name: "add_doctor",
    component: () => import("@v/page/add_doctor")
  },
  {
    path: "/doctor_info",
    name: "doctor_info",
    component: () => import("@v/page/doctor_info")
  },
  {
    path: "/select-department",
    name: "select-department",
    component: () => import("@v/page/select-department")
  },
  {
    path: "/choose_doctor",
    name: "choose_doctor",
    component: () => import("@v/page/choose_doctor")
  },
  {
    path: "/Appointment_message",
    name: "Appointment_message",
    component: () => import("@v/page/Appointment_message")
  },
  {
    path: "/more",
    name: "more",
    component: () => import("@v/page/more")
  },
  {
    path: "/hospital_profile",
    name: "Hospital_profile",
    component: () => import("@v/page/hospital_profile")
  },
  {
    path: "/do_change",
    name: "do_change",
    component: () => import("@v/page/do_change")
  },
  {
    path: "/register_message",
    name: "register_message",
    component: () => import("@v/page/register_message")
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@v/mine/login")
  },
  {
    path: "/inFrom",
    name: "inFrom",
    component: () => import("@v/mine/inFrom")
  },
  {
    path: "/help",
    name: "help",
    component: () => import("@v/mine/help")
  },
  {
    path: "/check",
    name: "check",
    component: () => import("@v/mine/check")
  },
  {
    path: "/shore",
    name: "shore",
    component: () => import("@v/mine/shore")
  },
  {
    path: "/new_info",
    name: "new_info",
    component: () => import("@v/page/new_info")
  },
  {
    path: "/App_over",
    name: "App_over",
    component: () => import("@v/page/App_over")
  },
  //健康科普
  {
    path: "/jiankangkepu",
    name: "jiankangkepu",
    component: () => import("@v/page/jiankangkepu")
  },
  {
    path: "/jiuyizhinan",
    name: "jiuyizhinan",
    component: () => import("@v/page/jiuyizhinan")
  },
  {
    path: "/bannerdetail",
    name: "bannerdetail",
    component: () => import("@v/page/bannerdetail")
  },
  {
    path: "/tishi",
    name: "tishi",
    component: () => import("@v/page/tishi")
  },
  {
    path: "/jiankangdetail",
    name: "jiankangdetail",
    component: () => import("@v/page/jiankangdetail")
  },
  {
    path: "/yuwenzhen",
    name: "yuwenzhen",
    component: () => import("@v/page/yuwenzhen")
  },
  {
    path: "/xieyi",
    name: "xieyi",
    component: () => import("@v/page/xieyi")
  }
];

const router = new VueRouter({
  // base: '/history',
  mode: "hash",
  base: process.env.BASE_URL,
  routes
});
// 路由变化时
router.beforeEach((to, from, next) => {
  next();
});
export default router;
